/**
 * Created by Administrator on 2017/7/12 0012.
 */
class Singleton{
    private static Singleton sin=null;
    private Singleton(){}
    public synchronized static Singleton getInstance(){
        if(sin==null){
            sin = new Singleton();
        }
        return sin;
    }
}

class Mydemo{
    public void Myprint(){
        System.out.println("11111");
    }

}

public class Test20170712 {
    public static void main(String[] args) {
        Singleton s1 = Singleton.getInstance();
        Singleton s2 = Singleton.getInstance();
        System.out.println("True  = [" + (s1==s2) + "]");
        Mydemo demo1 = new Mydemo();
        demo1.Myprint();
    }
}
